package com.yand.data.stack;


//栈 数据结构
//栈尾入 栈尾出   先入后出
public class Stack {

    private long [] arr;

    private int maxLength;

    private int statckTop;

    public  Stack(int maxSize){
        arr = new long[maxSize];

        this.maxLength = maxSize;
    }


    /**
     * 入栈
     * @param value
     */
    public void insertStack(long value){
        arr[statckTop++] = value;
    }




    //取出栈顶数据
    public long pop(){

        return arr[statckTop--];
    }

    boolean isFull(){

        return (statckTop == maxLength);
    }



    boolean isEmpty(){

        return (statckTop == 0);
    }



}
